package com.jvm.memory.leak;

import java.util.Objects;

/**
 * Person
 *
 * @author Lizhong
 * @date 2019/2/20
 */
public class Person{
    private String user;
    private String pwd;
    private int age;

    public Person(String user, String pwd, int age) {
        this.user = user;
        this.pwd = pwd;
        this.age = age;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "user='" + user + '\'' +
                ", pwd='" + pwd + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return age == person.age &&
                Objects.equals(user, person.user) &&
                Objects.equals(pwd, person.pwd);
    }

    @Override
    public int hashCode() {

        return Objects.hash(user, pwd, age);
    }
}